package com.pt25.service.sys.domain.config.ddo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pt25.base.util.JsonUtil;
import com.pt25.base.util.PageUtil;
import com.pt25.service.sys.repository.mysql.po.ConfigTypePo;
import lombok.*;

import java.time.LocalDateTime;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(
        callSuper = true
)
public class ConfigType extends PageUtil.PageBase {

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    private String typeName;

    private String typeTitle;

    private String typeDescription;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    private Integer delFlag;

    public ConfigTypePo toConfigTypePo() {
        return JsonUtil.toBean(JsonUtil.toJson(this), ConfigTypePo.class);
    }

    public static ConfigType toConfigType(ConfigTypePo configTypePo) {
        return JsonUtil.toBean(JsonUtil.toJson(configTypePo), ConfigType.class);
    }
}
